using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CoOperativeManagementSystem
{
    public partial class frmUpdateMember : Form
    {
        public dataBaseCtrl dbCtrl;
        public frmUpdateMember()
        {
            dbCtrl = new dataBaseCtrl();
            dbCtrl.openConnection();
            InitializeComponent();
        }

        private void btnUpdateMember_Click(object sender, EventArgs e)
        {

            string SQLUpdateString = "UPDATE tblMemberList SET Name ='" + txtMemberName.Text+ "'," + 
                "FlatNumber='" + txtFlatNumber.Text + "', ShareHoldingNumber = '" + txtShareHoldingNumber.Text + "' where DatabaseId =" + nDataBaseId;
            int response = dbCtrl.executeQuery(SQLUpdateString);
            if (response ==1)
            {
                MessageBox.Show("Update successful!","Message",MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Update Failed!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);               
            }               
            Close();
        }           
             
    }
}